package com.api.shopapi.service.impl;

import com.api.shopapi.entity.SBJSleepAlarm;
import com.api.shopapi.mapper.SBJSleepAlarmMapper;
import com.api.shopapi.service.SBJSleepAlarmService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("SBJSleepAlarmServiceImplOne")
public class SBJSleepAlarmServiceImpl implements SBJSleepAlarmService {


    @Autowired
    private SBJSleepAlarmMapper sbjSleepAlarmMapper;

    @Override
    public int insert(SBJSleepAlarm sleepAlarm) {
        return sbjSleepAlarmMapper.insert(sleepAlarm);
    }

    @Override
    public PageInfo<SBJSleepAlarm> getSleepAlarmPageByDeviceId(int pageIndex, int pageSize, String deviceId, String startTime, String endTime) {
        PageHelper.startPage(pageIndex,pageSize);
        List<SBJSleepAlarm> sbjSleepAlarmList = sbjSleepAlarmMapper.getSleepAlarmPageByDeviceId(deviceId, startTime, endTime);
        return new PageInfo<>(sbjSleepAlarmList);
    }
}
